package com.iv.durian.cloud.api.service;

import com.iv.durian.cloud.Lesson;
import com.iv.durian.cloud.facade.LessonFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zlw on 2018-06-30.
 */
@Service
public class LessonService {

    @Autowired
    private LessonFacade lessonFacade;

    public Lesson getLessonById(Integer lessonId){
        return lessonFacade.getById(lessonId);
    }

    public Lesson getLessonByName(String lessonName){
        return lessonFacade.getByName(lessonName);
    }

    public void addLesson(Lesson lesson){ lessonFacade.add(lesson); }

    public void removeLessonById( Integer id){
        lessonFacade.removeById(id);
    }

    public void updateLessonName(Integer lessonId,String lessonName){
        lessonFacade.updateLessonName(lessonId,lessonName);
    }

    public int countLesson(Integer status){return lessonFacade.count(status);}

    public List<Lesson> list(Integer status, Integer offset, Integer limit){
        return lessonFacade.list(status, offset, limit);
    }

}
